<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="packaging.*" %>


<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'doaccounts.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
   <%
	//为取出的值设置中文编码
	request.setCharacterEncoding("utf-8");
	//User user = (User)session.getAttribute("User");
	String orderid = request.getParameter("orderid");
	String orderMsg = request.getParameter("orderMsg");
	String total = request.getParameter("total");
	String address = request.getParameter("address");
	String email_std = request.getParameter("email");
	String memo = request.getParameter("memo");
	String sql = "insert into tbl_order(order_id,amount,address,email,order_msg,memo) values (?,?,?,?,?,?)";
	check db = new check();
	Object[] param = {orderid,total,address,email_std,orderMsg,memo} ;
	db.doUpdate(sql,param);
	String text = orderMsg+"\n总金额："+total +"\n发货地址："+address ;
	Email email = new Email();
	email.setSmtpServSrc("smtp."+Constant.EMAIL_ADDRESS.substring(Constant.EMAIL_ADDRESS.indexOf("@")+1));
	email.setAddressSrc(Constant.EMAIL_ADDRESS);
	email.setAddressStd(email_std);
	email.setUsernameSrc(Constant.EMAIL_USERNAME);
	email.setPasswordSrc(Constant.EMAIL_PASSWORD);
	email.setTitle("购物提醒");
	email.setContent(text);
	JavaMailTool.appacheSimpleSend(email);
	session.removeAttribute("car");
	response.sendRedirect("es.jsp");
%>

  </body>
</html>
